//
//  ProjectDefine.h
//  WiFiProject
//
//  Created by JianWei Chen on 17/2/6.
//  Copyright © 2017年 JianWei Chen. All rights reserved.
//

/*
 系统全局宏调用
 需要全局多个地方调用的宏整理到这里
 */

#ifndef ProjectDefine_h
#define ProjectDefine_h
#ifdef __OBJC__
/*
 常见并经常使用的宏
 */
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
#define GetViewWidth(view)    view.frame.size.width
#define GetViewHeight(view)   view.frame.size.height
#define GetViewX(view)        view.frame.origin.x
#define GetViewY(view)        view.frame.origin.y
#define StatusbarHeight       (20.f)
#define NavigationbarHeight   (44.f)
#define TabBarHeight          (49.f)
#define MAIN(block) dispatch_async(dispatch_get_main_queue(),block) //主函数调用
#define MAX_LIMIT_NUMS 400

//NSUserDefaults
#define SAVE_OBJECT(object,key) {[[NSUserDefaults standardUserDefaults] setObject:object forKey:key] ; [[NSUserDefaults standardUserDefaults]synchronize];}
#define SAVE_BOOL(value,key) {[[NSUserDefaults standardUserDefaults] setBool:value forKey:key] ; [[NSUserDefaults standardUserDefaults]synchronize];}
#define EXRACT_OBJECT(key)        [[NSUserDefaults standardUserDefaults] objectForKey:key]
#define EXRACT_BOOL(key) [[NSUserDefaults standardUserDefaults]boolForKey:key]
#define REMOVE_OBJECT(key)   [[NSUserDefaults standardUserDefaults]removeObjectForKey:key]
#define PorPath [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.png",DTCEXRACT_OBJECT(USERNAME)]]
#define PorImage(key) [UIImage imageWithContentsOfFile:key]
#define kDocument  NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0]
#define ConfigPath [kDocument stringByAppendingPathComponent:@"deviceconfig.plist"]
#define CommandDic(type) [kDocument stringByAppendingPathComponent:[NSString stringWithFormat:@"product/%@/config/device.json",type]]
#define PicPath(type) [kDocument stringByAppendingPathComponent:[NSString stringWithFormat:@"product/%@",type]]


#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
#define px1920Height(px)     (((px)/1920.0f) * SCREEN_HEIGHT)
#define px1080Width(px)     (((px)/1080.0f) * SCREEN_WIDTH)



/*
 网络库常用宏
 */
#define UID @"UID"
#define TOKEN @"TOKEN"
#define IMAGE @"IMAGE"
#define INFODIC @"INFODIC"
#define USERNAME @"USERNAME"
#define NICKNAME @"NICKNAME"
#define USERNAME @"USERNAME"    //将登录帐号存储到UserDefault时用
#define PASSWORD @"PASSWORD"    //将登录密码存储到UserDefault时用
#define LOGIN @"LOGIN"          //判断是否登录过
#define REGISTER @"REGISTER"          //判断是否注册过
#define AVATAR @"AVATAR"          //判断是否上传头像
#define ISNICKNAME @"ISNICKNAME"          //判断是否有昵称
#define SEX @"SEX"          //判断是否选择性别
#define MATCH @"MATCH"          //判断是否配对



#define VERSION @"1.0"          //版本
#define MAC   [UIDevice currentDevice].identifierForVendor.UUIDString
#define VERSION @"1.0"
#define OPENID @"OPENID"
#define MAC   [UIDevice currentDevice].identifierForVendor.UUIDString
#define SanBox 0
/*
 正测环境切换
 */
#if SanBox
#define DTCloudKitAppKey @"Myv3f4yQ9yiY1p7e1jOWuoxJJQe8U09w"
#define ServerURL @"http://120.24.55.58:8083/index.php"
#define TYPEID @"2283"
#define PRODUCTID @"50132"
#else
#define DTCloudKitAppKey @"qyfkbyDUf2WwNSMOKfPLhfmkRQoFu2OK"
#define ServerURL @"http://api.ourslinks.com/index.php"
#define TYPEID @"2283"
#define PRODUCTID @"50228"




#define kMQTTServerHost @""

#endif







/*
 项目使用宏，注意顺序别乱
 */


#endif
#endif /* ProjectDefine_h */
